import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import 'lib-flexible';

import {
  Button, Swipe, SwipeItem, Lazyload, Progress, Toast, Popup, Dialog,
} from 'vant';
// 防止熄屏
import NoSleep from 'nosleep.js/dist/NoSleep.min.js';

Vue.prototype.$NoSleep = NoSleep;

Vue.use(Button).use(Swipe).use(SwipeItem).use(Lazyload)
  .use(Progress)
  .use(Toast)
  .use(Popup)
  .use(Dialog);
Vue.config.productionTip = false;

Vue.filter('s_to_hs', (s) => {
  let h;
  h = Math.floor(s / 60);
  s %= 60;
  h += '';
  s += '';
  h = (h.length == 1) ? `0${h}` : h;
  s = (s.length == 1) ? `0${s}` : s;
  return `${h}:${s}`;
});

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount('#app');
